home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 January: Mac OS SDK / Dev.CD Jan 00 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / MachineExceptions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  6.3 KB  |  230 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        MachineExceptions.h
  3.  
  4.      Contains:    Processor Exception Handling Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1993-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __MACHINEEXCEPTIONS__
  19. #define __MACHINEEXCEPTIONS__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24.  
  25.  
  26.  
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_STRUCT_ALIGN
  40.     #pragma options align=power
  41. #elif PRAGMA_STRUCT_PACKPUSH
  42.     #pragma pack(push, 2)
  43. #elif PRAGMA_STRUCT_PACK
  44.     #pragma pack(2)
  45. #endif
  46.  
  47. /* Some basic declarations used throughout the kernel */
  48. typedef struct OpaqueAreaID*             AreaID;
  49. #if TARGET_OS_MAC
  50. /* Machine Dependent types for PowerPC: */
  51.  
  52. struct MachineInformationPowerPC {
  53.     UnsignedWide                     CTR;
  54.     UnsignedWide                     LR;
  55.     UnsignedWide                     PC;
  56.     unsigned long                     CR;
  57.     unsigned long                     XER;
  58.     unsigned long                     MSR;
  59.     unsigned long                     MQ;
  60.     unsigned long                     ExceptKind;
  61.     unsigned long                     DSISR;
  62.     UnsignedWide                     DAR;
  63.     UnsignedWide                     Reserved;
  64. };
  65. typedef struct MachineInformationPowerPC MachineInformationPowerPC;
  66.  
  67. struct RegisterInformationPowerPC {
  68.     UnsignedWide                     R0;
  69.     UnsignedWide                     R1;
  70.     UnsignedWide                     R2;
  71.     UnsignedWide                     R3;
  72.     UnsignedWide                     R4;
  73.     UnsignedWide                     R5;
  74.     UnsignedWide                     R6;
  75.     UnsignedWide                     R7;
  76.     UnsignedWide                     R8;
  77.     UnsignedWide                     R9;
  78.     UnsignedWide                     R10;
  79.     UnsignedWide                     R11;
  80.     UnsignedWide                     R12;
  81.     UnsignedWide                     R13;
  82.     UnsignedWide                     R14;
  83.     UnsignedWide                     R15;
  84.     UnsignedWide                     R16;
  85.     UnsignedWide                     R17;
  86.     UnsignedWide                     R18;
  87.     UnsignedWide                     R19;
  88.     UnsignedWide                     R20;
  89.     UnsignedWide                     R21;
  90.     UnsignedWide                     R22;
  91.     UnsignedWide                     R23;
  92.     UnsignedWide                     R24;
  93.     UnsignedWide                     R25;
  94.     UnsignedWide                     R26;
  95.     UnsignedWide                     R27;
  96.     UnsignedWide                     R28;
  97.     UnsignedWide                     R29;
  98.     UnsignedWide                     R30;
  99.     UnsignedWide                     R31;
  100. };
  101. typedef struct RegisterInformationPowerPC RegisterInformationPowerPC;
  102.  
  103. struct FPUInformationPowerPC {
  104.     UnsignedWide                     Registers[32];
  105.     unsigned long                     FPSCR;
  106.     unsigned long                     Reserved;
  107. };
  108. typedef struct FPUInformationPowerPC    FPUInformationPowerPC;
  109.  
  110. /* Exception related declarations */
  111.  
  112. enum {
  113.     kWriteReference                = 0,
  114.     kReadReference                = 1,
  115.     kFetchReference                = 2,
  116.     writeReference                = kWriteReference,                /* Obsolete name*/
  117.     readReference                = kReadReference,                /* Obsolete name*/
  118.     fetchReference                = kFetchReference                /* Obsolete name*/
  119. };
  120.  
  121.  
  122. typedef unsigned long                     MemoryReferenceKind;
  123.  
  124. struct MemoryExceptionInformation {
  125.     AreaID                             theArea;
  126.     LogicalAddress                     theAddress;
  127.     OSStatus                         theError;
  128.     MemoryReferenceKind             theReference;
  129. };
  130. typedef struct MemoryExceptionInformation MemoryExceptionInformation;
  131.  
  132. enum {
  133.     kUnknownException            = 0,
  134.     kIllegalInstructionException = 1,
  135.     kTrapException                = 2,
  136.     kAccessException            = 3,
  137.     kUnmappedMemoryException    = 4,
  138.     kExcludedMemoryException    = 5,
  139.     kReadOnlyMemoryException    = 6,
  140.     kUnresolvablePageFaultException = 7,
  141.     kPrivilegeViolationException = 8,
  142.     kTraceException                = 9,
  143.     kInstructionBreakpointException = 10,
  144.     kDataBreakpointException    = 11,
  145.     kIntegerException            = 12,
  146.     kFloatingPointException        = 13,
  147.     kStackOverflowException        = 14,
  148.     kTaskTerminationException    = 15,
  149.     kTaskCreationException        = 16
  150. };
  151.  
  152. #if OLDROUTINENAMES
  153.  
  154. enum {
  155.     unknownException            = kUnknownException,            /* Obsolete name*/
  156.     illegalInstructionException    = kIllegalInstructionException,    /* Obsolete name*/
  157.     trapException                = kTrapException,                /* Obsolete name*/
  158.     accessException                = kAccessException,                /* Obsolete name*/
  159.     unmappedMemoryException        = kUnmappedMemoryException,        /* Obsolete name*/
  160.     excludedMemoryException        = kExcludedMemoryException,        /* Obsolete name*/
  161.     readOnlyMemoryException        = kReadOnlyMemoryException,        /* Obsolete name*/
  162.     unresolvablePageFaultException = kUnresolvablePageFaultException, /* Obsolete name*/
  163.     privilegeViolationException    = kPrivilegeViolationException,    /* Obsolete name*/
  164.     traceException                = kTraceException,                /* Obsolete name*/
  165.     instructionBreakpointException = kInstructionBreakpointException, /* Obsolete name*/
  166.     dataBreakpointException        = kDataBreakpointException,        /* Obsolete name*/
  167.     integerException            = kIntegerException,            /* Obsolete name*/
  168.     floatingPointException        = kFloatingPointException,        /* Obsolete name*/
  169.     stackOverflowException        = kStackOverflowException,        /* Obsolete name*/
  170.     terminationException        = kTaskTerminationException,    /* Obsolete name*/
  171.     kTerminationException        = kTaskTerminationException        /* Obsolete name*/
  172. };
  173.  
  174. #endif  /* OLDROUTINENAMES */
  175.  
  176.  
  177. typedef unsigned long                     ExceptionKind;
  178.  
  179. union ExceptionInfo {
  180.     MemoryExceptionInformation *    memoryInfo;
  181. };
  182. typedef union ExceptionInfo                ExceptionInfo;
  183.  
  184. struct ExceptionInformationPowerPC {
  185.     ExceptionKind                     theKind;
  186.     MachineInformationPowerPC *        machineState;
  187.     RegisterInformationPowerPC *    registerImage;
  188.     FPUInformationPowerPC *            FPUImage;
  189.     ExceptionInfo                     info;
  190. };
  191. typedef struct ExceptionInformationPowerPC ExceptionInformationPowerPC;
  192.  
  193. typedef ExceptionInformationPowerPC     ExceptionInformation;
  194. typedef MachineInformationPowerPC         MachineInformation;
  195. typedef RegisterInformationPowerPC         RegisterInformation;
  196. typedef FPUInformationPowerPC             FPUInformation;
  197.  
  198. /* 
  199.     Note:    An ExceptionHandler is NOT a UniversalProcPtr.
  200.             It must be a PowerPC function pointer with NO routine descriptor. 
  201. */
  202. typedef CALLBACK_API_C( OSStatus , ExceptionHandler )(ExceptionInformationPowerPC *theException);
  203. /* Routine for installing per-process exception handlers */
  204. EXTERN_API( ExceptionHandler ) InstallExceptionHandler(ExceptionHandler theHandler);
  205.  
  206. #endif  /* TARGET_OS_MAC */
  207.  
  208.  
  209.  
  210. #if PRAGMA_STRUCT_ALIGN
  211.     #pragma options align=reset
  212. #elif PRAGMA_STRUCT_PACKPUSH
  213.     #pragma pack(pop)
  214. #elif PRAGMA_STRUCT_PACK
  215.     #pragma pack()
  216. #endif
  217.  
  218. #ifdef PRAGMA_IMPORT_OFF
  219. #pragma import off
  220. #elif PRAGMA_IMPORT
  221. #pragma import reset
  222. #endif
  223.  
  224. #ifdef __cplusplus
  225. }
  226. #endif
  227.  
  228. #endif /* __MACHINEEXCEPTIONS__ */
  229.  
  230.